home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 9307 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.6 KB

  1. Path: solon.com!not-for-mail
  2. From: seebs@solutions.solon.com (Peter Seebach)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Schildt <- Advanced Books
  5. Date: 8 Mar 1996 20:29:55 -0600
  6. Organization: Usenet Fact Police (Undercover)
  7. Message-ID: <4hqqf3$445@solutions.solon.com>
  8. References: <8BA8405.02C70020DE.uuout@sourcebbs.com> <danpop.826238706@rscernix> <4ho3m3$iov@solutions.solon.com> <danpop.826305987@rscernix>
  9. NNTP-Posting-Host: solutions.solon.com
  10.  
  11. In article <danpop.826305987@rscernix>, Dan Pop <danpop@mail.cern.ch> wrote:
  12. >My compiler _will_ warn about illegal integer to pointer conversion
  13. >and I NEVER ignore such a warning.  Moreover, even the silly cast in front
  14. >of malloc won't prevent gcc from telling me that something silly is
  15. >happening:
  16.  
  17. >    ues5:~/tmp 30> cat test.c
  18. >    main()
  19. >    {
  20. >    char *p = (char *)malloc(100);
  21. >    }
  22. >    ues5:~/tmp 31> gcc test.c
  23. >    test.c: In function `main':
  24. >    test.c:3: warning: cast to pointer from integer of different size
  25.  
  26. >But this is because I have the "privilege" of using a system where 
  27. >pointers and int's have different sizes.  It's amazing how much new free
  28. >software has to be fixed, even today, three years after the Alpha boxes
  29. >have hit the market.
  30.  
  31. Yes; there's some debate about this and related issues in gnu.misc.discuss.
  32.  
  33. I don't ignore warnings either, though I sometimes have to fight the system
  34. to get them.
  35.  
  36. >>The same book, at one point, declares
  37. >>    char *buf[128];
  38. >>and passes the buffer to something like fgets().  
  39.  
  40. >I'd stay away from any book which has untested examples.  We are all
  41. >human and we all make mistakes, but any serious author will, at least,
  42. >compile his examples to be sure they're correct and will introduce the
  43. >source code directly into the "manuscript", to be sure that no typo could
  44. >find its way in.  Many authors even document this practice, somewhere in
  45. >the preface (e.g. the last phrase on page ix of K&R2).
  46.  
  47. I actually find the book overall pretty good.  It's a book on XView, which
  48. means, there's no possible way to write legal code for it.  :)
  49.  
  50. I am pretty sure that most of the code in the book was brought in from
  51. source files; the source is available from their ftp site.
  52.  
  53. My guess would be that the '=^=' bug has to do with typesetters and
  54. global search-and-replace.
  55.  
  56. >Anybody using cc (without lint) on SunOS gets exactly what s/he deserves.
  57.  
  58. Yes, generally gcc, so s/he can compile real code.
  59.  
  60. -s
  61. -- 
  62. Peter Seebach - seebs@solon.com - Copyright 1996 Peter Seebach.
  63. C/Unix wizard -- C/Unix questions? Send mail for help.  No, really!
  64. FUCK the communications decency act.  Goddamned government.  [literally.]
  65. The *other* C FAQ - http://www.solon.com/~seebs/c/c-iaq.html
  66.